package com.hanamaki.array;

public class Demo04 {

    public static void main(String[] args) {

        int[] arr1 = {12, 43, 211, 7654, 31, 8642, 432};
        int max = max(arr1);
        System.out.println(max);

        System.out.println(arr1);


    }

    // 方法 ：打印数组中最大的值
    public static int max(int arr[]) {
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        return max;
    }
}
